﻿using Microsoft.AspNetCore.Http;
using ServiceCore.Tool.Post;
using ServiceCore.Tool.Wx.customservice;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Web;

namespace Entity
{
 
    #region 获取客服基本信息
    public class getkflist_params
    {

    }
    public class getkflist_result
    {
        public List<kf_list> kf_list { get; set; }
    }
    public class kf_list
    {
        /// <summary>
        /// 完整客服帐号，格式为：帐号前缀@公众号微信号
        /// </summary>
        public string kf_account { get; set; }
        /// <summary>
        ///  客服昵称
        /// </summary>
        public string kf_nick { get; set; }
        /// <summary>
        ///  客服编号
        /// </summary>
        public string kf_id { get; set; }
        /// <summary>
        ///  客服头像
        /// </summary>
        public string kf_headimgurl { get; set; }
        /// <summary>
        ///  如果客服帐号已绑定了客服人员微信号， 则此处显示微信号
        /// </summary>
        public string kf_wx { get; set; }

        /// <summary>
        ///如果客服帐号尚未绑定微信号，但是已经发起了一个绑定邀请， 则此处显示绑定邀请的微信号
        /// </summary>
        public string invite_wx { get; set; }
        /// <summary>
        /// 如果客服帐号尚未绑定微信号，但是已经发起过一个绑定邀请， 邀请的过期时间，为unix 时间戳
        /// </summary>
        public long invite_expire_time { get; set; }
        /// <summary>
        /// 邀请的状态，有等待确认“waiting”，被拒绝“rejected”， 过期“expired”
        /// </summary>
        public string invite_status { get; set; }
    }
    #endregion
    #region 添加客服
    public class kf_add_params
    {
        /// <summary>
        /// 完整客服帐号，格式为：帐号前缀@公众号微信号，帐号前缀最多10个字符，必须是英文、数字字符或者下划线，后缀为公众号微信号，长度不超过30个字符
        /// </summary>
        public string kf_account { get; set; }
        /// <summary>
        /// 客服昵称，最长16个字
        /// </summary>
        public string nickname { get; set; }
    }
    public class kf_add_result : base_wx_result
    {

    }
    #endregion
    #region 邀请绑定客服账号
    public class inviteworker_params
    {
        /// <summary>
        /// 完整客服帐号，格式为：帐号前缀@公众号微信号
        /// </summary>
        public string kf_account { get; set; }
        /// <summary>
        /// 接收绑定邀请的客服微信号
        /// </summary>
        public string invite_wx { get; set; }
    }

    public class inviteworker_result : base_wx_result
    {

    }
    #endregion
    #region 修改客服
    public class kf_update_params
    {
        public string kf_account { get; set; }

        public string nickname { get; set; }
    }

    public class kf_update_result : base_wx_result
    {

    }
    #endregion
    #region 图片上传
    public class uploadheadimg_params
    {
        public string kf_account { get; set; }

        public IFormFile media { get; set; }
    }
    public class uploadheadimg_result : base_wx_result
    {

    } 
    #endregion
    #region 删除客服
    public class kf_delete_params
    {
        public string kf_account { get; set; }
    }

    public class kf_delete_result : base_wx_result
    {

    }
    #endregion 
    #region 开启会话
    public class create_session_params
    {
        /// <summary>
        /// 完整客服帐号，格式为：帐号前缀@公众号微信号
        /// </summary>
        public string kf_account { get; set; }
        /// <summary>
        /// 粉丝的openid
        /// </summary>
        public string openid { get; set; }
    }

    public class create_session_result : base_wx_result
    {

    }
    #endregion 
    #region 关闭会话
    public class close_session_params: create_session_params
    {
      
    }

    public class close_session_result : base_wx_result
    {

    }
    #endregion
    #region 获取客服会话列表
    public class getsessionlist_params
    {
        public string kf_account { get; set; }
    }

    public class getsessionlist_result
    {
        public List<sessionlist> sessionlist { get; set; }
    }
    public class sessionlist
    {
        public long createtime { get; set; }

        public string openid { get; set; }
    }
    #endregion
    #region 获取客服未接入会话列表
    public class getwaitcase_params
    {

    }
    public class getwaitcase_result
    {
        /// <summary>
        /// 未接入会话数量
        /// </summary>
        public int count { get; set; }

        public List<waitcaselist> waitcaselist { get; set; }
    }
    public class waitcaselist
    {
        public long latest_time { get; set; }

        public string openid { get; set; }
    }
    #endregion
    #region 获取客户会话状态
    public class getsession_params
    {
        public string openid { get; set; }
    }

    public class getsession_result
    {
        public long createtime { get; set; }

        /// <summary>
        /// 完整客服帐号，格式为：帐号前缀@公众号微信号
        /// </summary>
        public string kf_account { get; set; }
    }
    #endregion 
    #region 文本消息发送
    public class send_text_params
    {
        public string touser { get; set; }
        public string msgtype { get; set; }
        public object text { get; set; }

        public object customservice { get; set; }
    }

    public class send_text_result : base_wx_result
    {

    }
    #endregion 
} 
namespace ServiceCore.Tool.Wx.customservice
{ 
    public class custom_config
    { 
  
        /// <summary>
        /// 定义接口访问集合
        /// </summary>
        public static url_list Api_Url
        {
            get
            {
                url_list result = new url_list(); 
                return result;
            }
        }
        public class url_list
        {
            /// <summary>
            /// 获取客服基本信息; 
            /// </summary>
            public string getkflist
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/customservice/getkflist";
                }
            }
            /// <summary>
            ///  添加客服帐号
            /// </summary>
            public string add
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfaccount/add";
                }
            }
            /// <summary>
            ///  邀请绑定客服帐号
            /// </summary>
            public string inviteworker
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfaccount/inviteworker";
                }
            }
            /// <summary>
            ///  设置客服信息
            /// </summary>
            public string update
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfaccount/update";
                }
            }
            /// <summary>
            /// 上传客服头像
            /// </summary>
            public string uploadheadimg
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg";
                }
            }
            /// <summary>
            /// 删除客服头像
            /// </summary>
            public string del
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfaccount/del";
                }
            }
            /// <summary>
            /// 创建会话
            /// </summary>
            public string create_session
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfsession/create";
                }
            }
            /// <summary>
            /// 删除会话
            /// </summary>
            public string close_session
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfsession/close";
                }
            }
            /// <summary>
            /// 获取客户会话状态
            /// </summary>
            public string getsession
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfsession/getsession";
                }
            }
            /// <summary>
            /// 获取客户会话列表
            /// </summary>
            public string getsessionlist
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfsession/getsessionlist";
                }
            }
            /// <summary>
            /// 获取未接入会话列表
            /// </summary>
            public string getwaitcase
            {
                get
                {
                    return "https://api.weixin.qq.com/customservice/kfsession/getwaitcase";
                }
            }

            public string send
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/message/custom/send";
                }
            }
        }
    }
}
